package com.ykt.controller;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.ykt.model.BaseData;
import com.ykt.service.BaseDataService;
import com.ykt.vo.ResultVo;

/**
 * @author long.hua
 * @version 1.0.0
 * @since 2016-04-17 15:58
 */
public class BaseDataController extends BaseController{


    private BaseDataService baseDataService = enhance(BaseDataService.class.getName(), BaseDataService.class);


    public void findDeliveryTimes(){
        List<BaseData> dataList = baseDataService.findByType(BaseData.DataType.DELIVERY_TIME.name());

        List<Map<String, String>> timeList = new LinkedList<Map<String, String>>();
        if(dataList != null){
            for (BaseData baseData : dataList) {
            	Map<String, String> dataMap = new HashMap<>();
            	dataMap.put("deliveryName", baseData.getName());
            	timeList.add(dataMap);
            }
        }

        returnJson(ResultVo.success(timeList));
    }

}
